<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<html>
<head>
    <base href="<%=basePath%><%!private Object basePath;%>">
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252" />
    <title>“墨趣”网上书城</title>
    <link rel="stylesheet" type="text/css" href="css/style.css" />
    <style>
        #box{
            height:120px;
            width:300px;
            margin:0 auto;
            border:0px solid #0066FF;
            overflow:hidden;
            padding-bottom:150px;
        }
        #box li{
            color:#8B3E2F;
            height:25px;
        }
        #box ul{
            margin:0px;
            padding:0px;
        }
    </style>
</head>
<body>
<div id="wrap">

       <div class="header">
       		<div class="logo"><a href="index.jsp"><img src="images/logo.gif" alt="" title="" border="0" /></a></div>
        <div id="menu">
            <ul>
                <li class="selected"><a href="index.jsp">首页</a></li>
                <li><a href="about.jsp">关于我们</a></li>
                <li><a href="category.jsp">所有图书</a></li>
                <li><a href="specials.jsp">特别推荐</a></li>
                <li><a href="details.jsp">图书详情</a></li>
                <li><a href="/orders/getlistByuid.action">我的订单</a></li>
                <%--*******************判断用户是否登录*******************--%>
                <c:if test="${empty loger}">
                    <li><a href="myaccount.jsp">登录</a></li>
                    <li><a href="register.jsp">注册</a></li>
                </c:if>
                <c:if test="${not empty loger}">
                    <li><a href="/user/doexit.action">退出</a></li>
                </c:if>
                <%--*******************判断用户是否登录*******************--%>
           </ul>
       </div>


      </div>


      <div class="center_content">
     <%-- **左边** --%>
       	<div class="left_content">
        	<div class="crumb_nav">
            <a href="index.jsp">首页</a> &gt;&gt; 所有图书
            </div>
            <div class="title"><span class="title_icon"><img src="images/bullet1.gif" alt="" title="" /></span><a href="index.jsp">所有图书</a></div>
           
           <div class="new_products" >
                    <div class="new_prod_box" id="nbody">

                    </div>
            <div class="pagination">
            <span class="disabled"><<</span><span class="current">1</span><a href="#?page=2">2</a><a href="#?page=3">3</a>…<a href="#?page=199">10</a><a href="#?page=200">11</a><a href="#?page=2">>></a>
            </div>  
            
            </div> 
          
            
        <div class="clear"></div>
        </div><!--end of left content-->

       <%-- **右边** --%>
           <div class="right_content">
               <div class="cart">
                   <div class="title"><span class="title_icon"><img src="images/cart.gif" alt="" title="" /></span>我的购物车</div>
                   <div class="home_cart_content">
                       3 件物品 | <span class="red">总计: 100￥</span>
                   </div>
                   <a href="/shopcar/getShopcarByUid.action" class="view_cart">查看购物车</a>
               </div>

               <div class="title">
                   <span class="title_icon">
                       <img src="images/bullet3.gif" alt="" title="" />
                   </span>书城公告
               </div>
               <div class="about" id="box">
                   <ul id="con1">

                   </ul>
               </div>

               <div class="right_box">

                   <div class="title"><span class="title_icon"><img src="images/bullet4.gif" alt="" title="" /></span>促销</div>
                   <div class="new_prod_box">
                       <a href="details.jsp">产品名称</a>
                       <div class="new_prod_bg">
                           <span class="new_icon"><img src="images/promo_icon.gif" alt="" title="" /></span>
                           <a href="details.jsp"><img src="images/thumb1.gif" alt="" title="" class="thumb" border="0" /></a>
                       </div>
                   </div>

                   <div class="new_prod_box">
                       <a href="details.jsp">产品名称</a>
                       <div class="new_prod_bg">
                           <span class="new_icon"><img src="images/promo_icon.gif" alt="" title="" /></span>
                           <a href="details.jsp"><img src="images/thumb2.gif" alt="" title="" class="thumb" border="0" /></a>
                       </div>
                   </div>

                   <div class="new_prod_box">
                       <a href="details.jsp">产品名称</a>
                       <div class="new_prod_bg">
                           <span class="new_icon"><img src="images/promo_icon.gif" alt="" title="" /></span>
                           <a href="details.jsp"><img src="images/thumb3.gif" alt="" title="" class="thumb" border="0" /></a>
                       </div>
                   </div>

               </div>

               <div class="right_box">

                   <div class="title"><span class="title_icon"><img src="images/bullet5.gif" alt="" title="" /></span>分类</div>

                   <ul class="list" id="typelist">

                   </ul>

                   <div class="title"><span class="title_icon"><img src="images/bullet6.gif" alt="" title="" /></span>伙伴</div>

                   <ul class="list">
                       <li><a href="#">饰品</a></li>
                       <li><a href="#">书籍礼品</a></li>
                       <li><a href="#">特别推荐</a></li>
                       <li><a href="#">节日礼品</a></li>
                       <li><a href="#">饰品</a></li>
                       <li><a href="#">书籍礼品</a></li>
                       <li><a href="#">特别推荐</a></li>
                       <li><a href="#">节日礼品</a></li>
                   </ul>
               </div>

           </div><!--end of right content-->

           <div class="clear"></div>
       </div><!--end of center content-->


    <div class="footer">
        <div class="left_footer"><img src="images/footer_logo.gif" alt="" title="" /><br /> <a href="http://www.cssmoban.com/" title="free templates">cssmoban</a></div>
        <div class="right_footer">
        </div>

    </div>
</div>
<script src="back/assets/js/jquery.min.js"></script>
<script>
    $(function(){
        console.log("asdf");
        $.getJSON("/notice/getNewFive.action","",function(res){
            for(var i=0;i<res.length;i++){
                var newtr="<li>" + res[i].content +"</li>";
                $("#con1").append(newtr);
            }
        });
    });
    var area=document.getElementById("box");
    area.innerHTML+=area.innerHTML;
    var liHeight=24;
    area.scrollTop=0;
    var delay=2000;
    var speed=50;
    var time;
    function starMove(){
        area.scrollTop++;
        time=setInterval("scrollUp()",speed);
    }
    function scrollUp(){
        if(area.scrollTop%liHeight==0){
            clearInterval(time);
            setTimeout("starMove()",delay);
        }else{
            area.scrollTop++;
            if(area.scrollTop>=area.offsetHeight/2){
                area.scrollTop=0;
            }
        }
    }
    setTimeout("starMove()",delay);
    $(function(){
        getbooklist('');
       /* $.getJSON("books/list.action","",function(res){
            for(var i=0;i<res.length;i++){
                var newtr=$("<div class=\"new_prod_box\"></div> ");
                newtr.append("<a href='/books/getbyid/2.action?bid="+res[i].id+"'>"+res[i].bname+"</a>");
                newtr.append("<div class=\"new_prod_bg\"><span class=\"new_icon\"><img src=\"images/promo_icon.gif\" /></span><a href=\"details.jsp\"><img src=\"images/thumb3.gif\" class=\"thumb\" border=\"0\" /></a></div>");
                $("#nbody").append(newtr);
            }
        });*/

        $.getJSON("booktype/list.action","",function(res){
            for(var i=0;i<res.length;i++){
                $("#typelist").append("<li><a href='#' onclick='getbooklist("+res[i].id+")' >"+res[i].typename+"</a></li>");
            }
        });
    })

    function getbooklist(typeid){
        $.getJSON("books/list.action","typeid="+typeid,function(res){
            $("#nbody").html("");
            for(var i=0;i<res.list.length;i++){
                var newtr=$("<div class=\"new_prod_box\"></div> ");
                newtr.append("<div class=\"new_prod_bg\"><a href='/books/getbyid/2.action?bid="+res.list[i].id+"'><img src=\"images/thumb3.gif\" class=\"thumb\" border=\"0\" /></a></div>");/*<span class="new_icon"><img src="images/promo_icon.gif" /></span>*/
                newtr.append("<a href='/books/getbyid/2.action?bid="+res.list[i].id+"'>"+res.list[i].bname+"</a>");
                $("#nbody").append(newtr);
            }
     });
    }
</script>
</body>
</html>